Skip to content

refactor(gossipsub/rpc): inline _decode_varint_at wrapper#739

Merged
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:refactor/rpc-decode-varint
May 21, 2026
Merged

refactor(gossipsub/rpc): inline _decode_varint_at wrapper#739
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:refactor/rpc-decode-varint

Conversation

@tcoratger
Copy link
Copy Markdown
Collaborator

Summary

  • Remove the _decode_varint_at wrapper in gossipsub/rpc.py. It only converted the canonical (value, bytes_consumed) return into (value, new_position) by adding pos.
  • Each of the five call sites now uses the standard value, consumed = decode_varint(data, pos); pos += consumed pattern, matching every other decode_varint consumer in the codebase (snappy, reqresp, transport/quic, behavior, event_source/gossip).
  • Net −6 lines; no behavior change.

Test plan

  • uv run pytest tests/lean_spec/subspecs/networking/gossipsub/ — 173 tests pass.
  • grep _decode_varint_at across src/, tests/, packages/ — no remaining references.

🤖 Generated with Claude Code

The wrapper only converted the canonical "(value, bytes_consumed)"
return shape into "(value, new_position)" by adding pos. Every other
consumer of decode_varint in the codebase already uses the canonical
"(value, consumed); pos += consumed" pattern, so removing the
wrapper aligns this module with the rest.

Net six lines smaller; no behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger merged commit 2027419 into leanEthereum:main May 21, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant